package com.ycw.servlet.guoguo;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.ycw.dao.LogisticsDao;
import com.ycw.dao.impl.LogisticsDaoImpl;

/**
 * Servlet implementation class ShowLogisticsDataByID
 */
@WebServlet("/showLogisticsDataByIDServlet")
public class ShowLogisticsDataByIDServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doPost(request, response);
	}

	/**
	 * 根据请求的l_id返回后勤人员信息
	 */
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		/**
		 * 请求id查询数据的详细信息
		 */
		String id = request.getParameter("l_id");
		LogisticsDao ld = LogisticsDaoImpl.getInstance();
		Integer l_id = Integer.parseInt(id);

		/**
		 * 根据id查询数据的详细信息
		 */
		Map<String, Object> map = ld.queryLogisticsDataByID(l_id);

		String resJSNO = JSON.toJSONString(map);
		PrintWriter out = response.getWriter();
		out.write(resJSNO);
	}

}
